Skip to content

[Bugfix] Support substitution events with no replacement player #440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DriesDeprest
Copy link
Contributor

Currently, in our StatsPerform deserializer we potentially set the replacement_player as None in case the player off event is not directly followed by a player on event, which happens in approx 1% of the matches, see: https://github.com/PySport/kloppy/blob/master/kloppy/infra/serializers/event/statsperform/deserializer.py#L396-L406.

In order to support substitution events where no new sub on player is coming on the pitch for the sub off player, we add a check to see whether the replacement player actually exists prior to updating its position.

For context, a related discussion on substitution events: #362.

@probberechts
Copy link
Contributor

If there is no other player coming on the pitch, it should not be counted as a subsitution, right? In Stats Perform data, these should be "Player retired" events.

Do you know why the replacement_player is missing? I have two hypotheses:

  1. There is a player off event, but not necessarily as the next event? This should be addressed in the deserializer.
  2. The event data is incomplete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants